package com;

import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import com.bean.Teacher;
import com.opensymphony.xwork2.ActionSupport;
import com.service.TeacherService;


public class ModifyTeacher extends ActionSupport {
	/**
	 *  
	 */
	private static final long serialVersionUID = 1L;
	
	@Resource(type=Teacher.class)
	private Teacher teacher;
	
	@Autowired
	@Qualifier("teacherService")
	private TeacherService teacherService;

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public String execute() throws Exception
	{
		try 
		{
			setTeacher(teacherService.getTeacherById(teacher.getId()));
			return SUCCESS;
		} 
		catch (Exception e) 
		{
			e.printStackTrace();
			return ERROR;
		}
	}

}
